home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Draw / Include / ShpTrakr.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.9 KB  |  142 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ShpTrakr.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef SHPTRAKR_H
  13. #define SHPTRAKR_H
  14.  
  15. // ----- Part Layer -----
  16.  
  17. #ifndef FWTRACKR_H
  18. #include "FWTrackr.h"
  19. #endif
  20.  
  21. // ----- OS Layer -----
  22.  
  23. #ifndef FWRECT_H
  24. #include "FWRect.h"
  25. #endif
  26.  
  27. #ifndef FWINK_H
  28. #include "FWInk.h"
  29. #endif
  30.  
  31. #ifndef FWSTYLE_H
  32. #include "FWStyle.h"
  33. #endif
  34.  
  35. //========================================================================================
  36. //    Forward class declarations
  37. //========================================================================================
  38.  
  39. class FW_CLASS_ATTR CBaseShape;
  40.  
  41. //========================================================================================
  42. //    class CShapeTracker
  43. //========================================================================================
  44.  
  45. class FW_CLASS_ATTR CShapeTracker : public FW_CTracker
  46. {
  47. //----------------------------------------------------------------------------------------
  48. //    Constructor/Destructor
  49. //
  50. public:
  51.     CShapeTracker(Environment* ev, 
  52.                 FW_CView* view, 
  53.                 ODFacet* facet, 
  54.                 CBaseShape* theShape, 
  55.                 FW_Boolean gridOn);
  56.     virtual ~CShapeTracker();
  57.  
  58. //----------------------------------------------------------------------------------------
  59. //    Inherited API
  60. //
  61. public:
  62.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  63.                                 const FW_CPoint& anchorPoint);
  64.     virtual FW_CPoint     ContinueTracking(Environment* ev, 
  65.                                 const FW_CPoint& anchorPoint, 
  66.                                 const FW_CPoint& previousPoint, 
  67.                                 const FW_CPoint& currentPoint);
  68.     virtual FW_Boolean    EndTracking(Environment* ev, 
  69.                                 const FW_CPoint& anchorPoint, 
  70.                                 const FW_CPoint& lastPoint);
  71.         
  72. //----------------------------------------------------------------------------------------
  73. //    New API
  74. //
  75. protected:
  76.     void            ForceToGrid(Environment* ev, FW_CPoint& point);
  77.     
  78. //----------------------------------------------------------------------------------------
  79. //    Data Members
  80. //
  81. private:
  82.     CBaseShape* fShape;
  83.     FW_Boolean     fErase;
  84.     FW_Boolean    fGridOn;
  85. };
  86.  
  87. //========================================================================================
  88. //    class CResizeTracker
  89. //========================================================================================
  90.  
  91. class FW_CLASS_ATTR CResizeTracker : public FW_CTracker
  92. {
  93. //----------------------------------------------------------------------------------------
  94. //    Constructor/Destructor
  95. //
  96. public:
  97.     CResizeTracker(Environment* ev, 
  98.                     FW_CView* view, ODFacet* facet,
  99.                     CBaseShape* theShape, short whichHandle,
  100.                     const FW_PInk& resizeInk, const FW_PStyle& resizeStyle,
  101.                     FW_Boolean gridOn);
  102.     virtual ~CResizeTracker();
  103.  
  104. //----------------------------------------------------------------------------------------
  105. //    Inherited API
  106. //
  107. public:
  108.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  109.                             const FW_CPoint& anchorPoint);
  110.     virtual FW_CPoint     ContinueTracking(Environment* ev, 
  111.                             const FW_CPoint& anchorPoint, 
  112.                             const FW_CPoint& previousPoint, 
  113.                             const FW_CPoint& currentPoint);
  114.     virtual FW_Boolean    EndTracking(Environment* ev, 
  115.                             const FW_CPoint& anchorPoint, 
  116.                             const FW_CPoint& lastPoint);
  117.  
  118. //----------------------------------------------------------------------------------------
  119. //    New API
  120. //
  121. public:
  122.     void        GetLastLocation(FW_CPoint& lastLocation)
  123.                     {lastLocation = fLastLocation;}
  124.     
  125. private:
  126.     void        ForceToGrid(Environment* ev, FW_CPoint& point);
  127.     
  128. //----------------------------------------------------------------------------------------
  129. //    Data Members
  130. //
  131. private:
  132.     CBaseShape* fShape;
  133.     short        fWhichHandle;
  134.     FW_Boolean     fErase;
  135.     FW_PInk        fResizeInk;
  136.     FW_PStyle    fResizeStyle;
  137.     FW_CPoint    fDelta;
  138.     FW_Boolean    fGridOn;
  139.     FW_CPoint    fLastLocation;
  140. };
  141.  
  142. #endif